﻿#pragma once

#include "Const.h"
#include "PictureCtrl.h"

// 游戏难度
typedef enum GameDifficulty {
    EASY = 9,       // 简单
    MEDIUM = 25,    // 中等
    HARD = 36       // 困难
} GameDifficulty;

// 游戏状态
typedef enum GameStatus {
    END,    // 已结束
    PLAYING // 游戏中
} GameStatus;

typedef struct Game Game;

typedef void (*GameDelete)(Game*);
typedef void (*GameMovePicture)(Game*, UINT);
typedef void (*GameSetDifficulty)(Game*, GameDifficulty);
typedef void (*GameSetPicture)(Game*, HBITMAP);
typedef void (*GameSetPictureBorder)(Game*, BOOL);
typedef void (*GameStart)(Game*);

// 游戏
struct Game {
    HWND mCallback;                                 // 回调
    GameDifficulty mDifficulty;                     // 难度
    HDC mDrawer;                                    // 绘图者
    POINT mEmptyPoint;                              // 空点，即没有图的那个点
    HWND mGameBoard;                                // 游戏区域
    HBITMAP mImage;                                 // 图片
    HDC mImageDC;                                   // 图片保存者
    BOOL mPicHasBorder;                             // 图片控件是否有边框标志
    PictureCtrl* mPictures[MAX_PICTURE_CTRL_COUNT]; // 图片控件数组
    GameStatus mStatus;                             // 状态

    GameDelete deleteSelf;
    GameMovePicture movePicture;
    GameSetDifficulty setDifficulty;
    GameSetPicture setPicture;
    GameSetPictureBorder setPictureBorder;
    GameStart start;
};

Game* New_Game(HWND, HDC, HWND);
